import request from '@/utils/request'
import qs from 'qs'
//登录
export const login = (data) => request.post('/manage/login', data)

//分页获取用户列表
export const getUserList = (data) => request.post('/users', data)

//登录
export const loginService = (data) => request.post('/admin/user/login', data)

//获取验证码
export const getCodeService = (data) => request.post('/admin/user/code', data)

//注册
export const registerService = (data) => request.post('/admin/user/register', data)

//批量删除ids:12,13,14
export const batchDeleteService = (ids) =>
  request.delete('/admin/user', {
    params: { ids }, // ✅ 正确格式：{ ids: [1,2,3] }
    paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'repeat' }), // 处理数组为重复键
  })

//增加一个用户'
export const addService = (data) => request.post('/admin/user/regist', data)

//分页查询 query参数
// export const queryByPageService=(data)=>request.get('/admin/user/page',{params:data})
export const queryByPageService = (data) => request.get('/admin/user/page?', { params: data })

//修改
export const updateService = (data) => request.put('/admin/user', data)
